import React, { Component } from 'react'
import {connect} from 'react-redux'
import Nice from './nice'

class ComA extends Component {
    handleClick = () => {
        console.log(this.props);
        this.props.sendAction();
        
    }
    jian = () => {
        this.props.jianAction();
    }
        
    
    render() {
        return (
            <div>
                <button onClick={this.handleClick}>+</button>
                <button onClick={this.jian}> - </button>
                <Nice/>

            </div>
        )
    }
}
const mapDispatchToProps = (dispatch) => {
    return {
        sendAction: () => {
            dispatch({
                type: 'add_action'
            })
        },
        jianAction: () => {
            dispatch({
                type: 'jian_action'
            })
        }
    }

}

export default connect(null,mapDispatchToProps)(ComA)
